package com.bitauto.i.commonUtils.model;

public class Result<T> {

    private Integer status;
    private String message;
    private T data;

    public Result() {
    }

    public Result(Integer status, String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public static <T> Result<T> success( String message, T data){
        return new Result(1,message,data);
    }

    public static Result success(){
        return new Result(1,"",null);
    }

    public static <T> Result<T> failure( String message, T data){
        return new Result(0,message,data);
    }

    public static Result failure(String message){
        return new Result(0,message,null);
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isSuccess() {
        if(status==1){
            return true;
        }else {
            return false;
        }
    }

}
